@page "/settings"
@inject DataService data

<span>Username</span>
<div class="input-group">
    <input @bind="name" class="form-control" />
    <div class="input-group-append">
        <button @onclick="UpdateUser" type="button" class="btn btn-outline-secondary">Update</button>
    </div>
</div>

@code{
    private string name = "";

    protected override void OnInitialized()
    {
        name = data.CurrentUser.Name;
    }
    async Task UpdateUser()
    {
        await data.GetOrCreateUser(name);
    }
}
